package com.zrrd.gmall.item.controller;

import com.zrrd.gmall.common.result.Result;
import com.zrrd.gmall.item.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/api/item")
public class ItemApiController {

    @Autowired
    private ItemService itemService;

    //获取商品详情
    @GetMapping("/{skuId}")
    public Result<Map<String,Object>> getSkuById(@PathVariable("skuId") Long skuId){
        Map<String, Object> map = itemService.getSkuById(skuId);
        //返回结果
        return Result.ok(map);
    }
}
